<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>南京大学职业咨询室预约平台</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='assets/i/ico_128X128.ico') }}">
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="{{ url_for('static', filename='assets/i/app-icon72x72@2x.png') }}">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/amazeui.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/amazeui.datetimepicker.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/js/webuploader/webuploader.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='assets/css/app.css', v='1.4') }}">
    <script src="{{ url_for('static', filename='assets/js/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='assets/js/amazeui.min.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='assets/js/amazeui.datetimepicker.min.js') }}"></script>
    <script src="{{ url_for('static', filename='assets/js/webuploader/webuploader.min.js') }}"></script>
    <style type="text/css">
    .main {
        text-align: center;
    }
    
    #contact,
    #password {
        height: 35px;
        width: 180px;
        border: none;
    }
    
    .item {
        color: blue;
        background-color: #E93EFF;
        height: 30px;
        width: 50px;
    }
    
    #table1,
    #table2 {
        text-align: center;
    }
    .article-table tr td:first-child{
        width:15%;
    }
    .article-table tr td:nth-child(2){
        width:80%;
    }

    </style>
</head>

<body>
<div class="admin-header">
    <div class="header-title">滚动图编辑</div>
</div>
<div class="content">
    <br>
    <div class="main">
         <div class="add_teacher">
              <form method="post" name="njusub" action="/" id="form1">
            <table class="am-table am-table-centered article-table" id="table1" cellpadding="0" cellspacing="0" style="border:none;">
                <tr>
                    <strong>滚动图编辑</strong>
                </tr>
                <tr>
                    <td><label>标题</label></td>
                    <td>
                        <input class="input am-form-field" type="text" name="title" id="id_title" value="{{article['title']}}" style="width:100%;height: 100%;">
                    </td>
                </tr>

                <!--<tr>-->
                    <!--<td><label>简介</label></td>-->
                    <!--<td>-->
                        <!--<input class="input am-form-field" type="text" name="description" id="id_description" value="{{article['description']}}" style="width:100%;height: 100%;">-->
                    <!--</td>-->

                <!--</tr>-->


                  <tr>
                    <td><label>配图</label></td>
                    <td style="position:relative;text-align:left;">
                        <span id="picker">上传配图</span>
                        <img id="article-img" src="{{ article['img'] }}" style="border:1px solid #0c79b1;height:80px;margin:0 10px;"/>
                        <input type="hidden" name="img" id="id_img" value="{{ article['img'] }}"/>
                    </td>
                </tr>

                <tr>
                    <td><label>链接地址</label></td>
                    <td>
                        <input class="input am-form-field" type="text" name="link" id="id_link" value="{{ article['link'] }}" style="width:100%;height: 100%;">
                    </td>

                </tr>

                <!--<tr>-->
                    <!--<td><label>内容</label></td>-->
                     <!--<td>-->
                         <!--<textarea class="input" type="text" name="content" id="id_content" style="width:100%;height: 200px;border:1px solid #e6e6e6" placeholder="请简述想要咨询的具体问题及对应需求"></textarea>-->
                     <!--</td>-->
                <!--</tr>-->
            </table>
                  <input type="hidden" name="id" value="{{ article['id'] }}"/>
        </form>

            <div>
                <br>
                <button id="commit_tch" value="" class="am-btn am-btn-primary am-btn-sm">提交</button>
                <button id="commit_tch_ret" value="" class="am-btn am-btn-default am-btn-sm" onclick="window.location.href='./admin_center';">返回</button>
            </div>
        </div>

    </div>

    </div>





</div>

<script type="text/javascript">
$(function(){


    //var editor = CKEDITOR.replace( 'id_content' );
    var uploader = WebUploader.create({

            // swf文件路径
            swf: '/static/assets/js/webuploader/Uploader.swf',

            // 文件接收服务端。
            server: '/fileupload',

            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#picker',

            // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
            resize: false,
            // 只允许选择图片文件。
            accept: {
                title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png',
                mimeTypes: 'image/jpg,image/gif,image/png,image/jpeg,image/bmp'
            }
    });
        uploader.on( 'fileQueued', function( file ) {
            uploader.upload();
        });
        uploader.on("uploadSuccess",function(file,data){
            $("#id_img").val(data.url);
            $("#article-img").attr("src",data.url);
        });

        $("#commit_tch").click(function() {

        var a = $("#id_title").val();
        if (isArguInValid(a)) {
            alert("请将信息填写完整！");
            return false;
        } else {
                //当前咨询师预约按钮置灰
                $.ajax({
                    // 请求发送方式
                    type: 'post',
                    // 验证文件
                    url: '/admin_edit_slider_submit',
                    // 用户输入的帐号密码
                    data: $("#form1").serialize(),
                    // 异步，不写默认为True
                    async: 0,
                    //请求成功后的回调
                    success: function(data) {
                        if (data) {
                            if (data.result == "1") {
                                alert(data.msg);
                            } else {
                                alert("操作成功");
                                window.location.href = "./admin_slider_lists";
                            };
                        } else {
                            alert('添加失败');
                        }
                    },
                    error: function() {
                        alert('服务端异常');
                    }
                });
        }
    });




})


    function isArguInValid(a) {
        if (a == undefined || a == "") {
            return true;
        };
    }

     function isValidEmail(a) {
        return true;
    }





</script>
</body>

</html>
